package ui.fl 
{
	import common.event.DUIEventer;
	import common.util.FilterUtil;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	
	/**
	 * ...
	 * @author Surui
	 */
	public class DUIBuildingEx extends Sprite 
	{
		/** 物品ID */
		private var m_id:int;
		/** 物品皮肤 */
		private var m_builder:MovieClip;
		/** 高亮 */
		private var m_light:Boolean;
		public function DUIBuildingEx() 
		{
		}
		/**
		 * 设置皮肤
		 * @param	builder
		 */
		public function setSkin( builder:MovieClip, rotation:int = 0 ):void {
			this.m_builder = builder;
			m_builder.gotoAndStop( rotation + 1 );
			this.addChild( m_builder );
		}
		/**
		 * 翻转建筑
		 */
		public function rotate():void {
			this.m_builder.gotoAndStop(1);
			DUIEventer.dispatch(DUIEventer.ROTATE_MAP_OBJ, this.m_id);
		}
		
		public function get itemId():int 
		{
			return m_id;
		}
		
		public function set itemId(value:int):void 
		{
			m_id = value;
		}
		
		public function get light():Boolean 
		{
			return m_light;
		}
		
		public function set light(value:Boolean):void 
		{
			m_light = value;
			if ( value ) {
				this.filters = [FilterUtil.OVER_SHADOW];
			} else {
				this.filters = [];
			}
		}
		
	}

}